﻿Imports System.Math
Public Class AJUSTE
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If MaskedTextBox1.Text = "  /  /" Or MaskedTextBox2.Text = "  /  /" Then
            MsgBox("Favor informar a data para calculo", MsgBoxStyle.Information, "Atenção")
        Else
            TextBox2.Text = DateDiff(DateInterval.Day, CType(MaskedTextBox1.Text, Date), CType(MaskedTextBox2.Text, Date))
            Button2.Enabled = True
        End If
    End Sub
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        If TextBox3.Text = "" Then
            MsgBox("Favor informar a taxa", MsgBoxStyle.Information, "Atenção")
        Else
            TextBox4.Text = (((TextBox3.Text) / 30) * (TextBox2.Text))
            Button3.Enabled = True
        End If
    End Sub
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        TextBox5.Text = (TextBox1.Text) * (TextBox4.Text) / 100
        TextBox6.Text = (TextBox1.Text) - (TextBox7.Text)
    End Sub
    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        TextBox10.Text = (TextBox6.Text) * (TextBox9.Text) / 100
        Button7.Enabled = True
    End Sub
    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        If MaskedTextBox2.Text = "  /  /" Or MaskedTextBox3.Text = "  /  /" Then
            MsgBox("Favor informar data", MsgBoxStyle.Information, "Atenção")
        Else
            TextBox8.Text = DateDiff(DateInterval.Day, CType(MaskedTextBox2.Text, Date), CType(MaskedTextBox3.Text, Date))
            Button5.Enabled = True
        End If
    End Sub
    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        TextBox9.Text = (((TextBox3.Text) / 30) * (TextBox8.Text))
        Button6.Enabled = True
    End Sub
    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
        Dim a As Double = TextBox7.Text
        Dim b As Double = TextBox5.Text
        Dim c As Decimal = TextBox10.Text
        TextBox11.Text = Round(a, 2) + Round(b, 2) + Round(c, 2) + 12
    End Sub
    Private Sub AJUSTE_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        TextBox1.Focus()
    End Sub
    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
        TextBox1.Text = Format(TextBox1.Text, "CURRENCY")
    End Sub
    Private Sub TextBox5_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox5.LostFocus
        TextBox5.Text = Format(TextBox5.Text, "CURRENCY")
    End Sub
    Private Sub TextBox10_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox10.TextChanged
        TextBox10.Text = Format(TextBox10.Text, "CURRENCY")
    End Sub
    Private Sub TextBox11_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox11.LostFocus
        TextBox11.Text = Format(TextBox11.Text, "CURRENCY")
    End Sub
    Private Sub TextBox7_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox7.LostFocus
        TextBox7.Text = Format(TextBox7.Text, "CURRENCY")
    End Sub
End Class